import ctypes


class Struct_data(ctypes.Structure):
    _fields_ = [
        ("file_name", ctypes.c_char_p),
        ("Version", ctypes.c_char_p),
        ("Name", ctypes.c_char_p),
        ("Name_ru", ctypes.c_char_p),
        ("Comment", ctypes.c_char_p),
        ("Comment_ru", ctypes.c_char_p),
        ("Exec", ctypes.c_char_p),
        ("Icon", ctypes.c_char_p),
        ("Terminal", ctypes.c_char_p),
        ("Type", ctypes.c_char_p),
        ("Categories", ctypes.c_char_p),
        ("StartupNotify", ctypes.c_char_p),
        ("X_XfcePluggable", ctypes.c_char_p),
        ("OnlyShowIn", ctypes.c_char_p),
        ("X_XfceHelpPage", ctypes.c_char_p),
        ("X_UBLHelpPage", ctypes.c_char_p),
    ]


obj_c_tools = ctypes.CDLL("handlers/tools.so", mode=ctypes.RTLD_GLOBAL)
obj_c_tools.execute.argtypes = [ctypes.c_char_p]
# obj_c_tools.execute.restype = ctypes.c_void_p

obj_c_tools.python_main()
obj_c_tools.get_data.argtypes = [ctypes.c_int]
obj_c_tools.get_data.restype = Struct_data
# obj_c_tools.len_struct.argtypes = []
obj_c_tools.len_struct.restype = ctypes.c_int
# print(obj_c_tools.get_data(0).X_UBLHelpPage.decode(),obj_c_tools.len_struct())
